package com.caigou.modules.channel.adapter

import android.text.TextUtils
import com.caigou.comm.base.utils.ImageLoader
import com.caigou.modules.channel.R
import com.caigou.modules.channel.bean.FriendItemBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2021/10/28
 */
class FriendAdapter(dataset: MutableList<FriendItemBean>) : BaseQuickAdapter<FriendItemBean, BaseViewHolder>(R.layout.item_friend_list, dataset),
    LoadMoreModule {
    override fun convert(holder: BaseViewHolder, item: FriendItemBean) {
        if (!TextUtils.isEmpty(item.headImg)) {
            ImageLoader.loadCircle(context, item.headImg, holder.getView(R.id.friend_item_iv_avatar))
        } else {
            holder.setImageResource(R.id.friend_item_iv_avatar, R.drawable.img_comm_avatar)
        }

        holder.setText(R.id.friend_item_tv_nickname, item.nickName)
        holder.setText(R.id.friend_item_tv_remark, item.friendRemark);
    }
}